<template>
  <div class="cont">
    <el-card>
      <div class="header">
        <div>
          <el-input
            v-model="name"
            style="width: 300px; margin-right: 5px"
            placeholder="按订单号查询"
          ></el-input>
          <el-input
            v-model="value"
            style="width: 300px; margin-right: 5px"
            placeholder="按套餐查询"
          ></el-input>
          <el-button type="primary" @click="handleInit">查询</el-button>
          <el-button type="success" @click="handleInit" icon="el-icon-refresh"
            >刷新</el-button
          >
        </div>
        <div>
          <!-- <el-button type="primary" @click="addUser">添加公海用户</el-button> -->
        </div>
      </div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="createTime" label="日期"> </el-table-column>
        <el-table-column prop="orderId" label="订单号"> </el-table-column>
        <el-table-column prop="price" label="金额"> </el-table-column>
        <el-table-column prop="num" label="套餐人数"> </el-table-column>
        <el-table-column prop="name" label="套餐"> </el-table-column>
        <el-table-column prop="inTime" label="天数"> </el-table-column>
      </el-table>
    </el-card>
    <!--分页组件-->
    <el-pagination
      @current-change="handleCurrentChange"
      layout="total, prev, pager, next"
      :total="total"
    ></el-pagination>
  </div>
</template>
<script>
import { kList } from "@/api/company";
export default {
  data() {
    return {
      tableData: [],
      page: 1,
      size: 10,
      total: 1,
      name: '',
      value: ''
    };
  },
  mounted() {
    this.handleInit();
  },
  methods: {
    // 获取数据
    handleInit() {
      let form = {
        page: this.page,
        size: this.size,
        orderId: this.name,
        pid: this.value
      };
      kList(form).then((res) => {
        this.tableData = res.result.records;
        this.total = Number(res.result.total);
      });
    },
    //分页
    handleCurrentChange(val) {
      this.page = val;
      this.handleInit();
    },
  },
};
</script>
<style scoped>
.cont {
  width: 100%;
  padding: 15px;
  box-sizing: border-box;
}
  .header {
  width: 100%;
  display: flex;
  justify-content: space-between;
}
</style>